/*
 * Copyright (c) 2017,安徽皖通科技股份有限公司 All rights reserved.
 */

package com.wttech.dzzf.process.model;

import lombok.Data;
import lombok.ToString;
import org.apache.commons.lang.builder.HashCodeBuilder;

/**
 * 重复客户信息比较属性键值
 *
 * @author MaShibo
 * @date 2017/12/9.
 */
@Data
@ToString
public class RepeatKey {

	private Integer agentIdType;

	private String agentIdNum;

	public RepeatKey(Integer agentIdType, String agentIdNum) {
		this.agentIdType = agentIdType;
		this.agentIdNum = agentIdNum;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj != null && obj instanceof RepeatKey && agentIdNum != null && agentIdType != null &&
				((RepeatKey) obj).getAgentIdNum().equals(agentIdNum) && ((RepeatKey) obj).getAgentIdType().equals(agentIdType)) {
			return true;
		}
		return false;
	}

	public boolean canGroup(){
		return agentIdType != null && agentIdNum != null;
	}

	@Override
	public int hashCode() {
		return HashCodeBuilder.reflectionHashCode(this);
	}
}
